//
//  ViewController.m
//  地图
//
//  Created by 周成龙 on 16/10/11.
//  Copyright © 2016年 ZCL. All rights reserved.
//

#import "ViewController.h"

@import CoreLocation;
@import MapKit;

@interface ViewController ()<CLLocationManagerDelegate>

@property (nonatomic, strong) CLLocationManager *manager;

@end

@implementation ViewController

- (CLLocationManager *)manager
{
    if (!_manager) {
        _manager = [[CLLocationManager alloc] init];
        _manager.delegate = self;
        // iOS8以后必须加
        [_manager requestAlwaysAuthorization];
    }
    return _manager;
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    // startUpdatingLocation
    [self. manager startUpdatingLocation];
}

- (void)locationManager:(CLLocationManager *)manager
     didUpdateLocations:(NSArray<CLLocation *> *)locations
{
    NSLog(@"定位到了");
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
